package phone.qyg.com.qyg;

import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.app.application.QXApplication;
import com.app.base.tool.BaseActivity;
import com.app.config.ApplicationConfig;
import com.app.utils.CommonUtil;
import com.app.utils.SharePrefUtil;
import com.app.utils.TransformController;
import com.app.view.AdvertView;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

import java.util.Arrays;
import java.util.List;

/**
 * 作者：lblbh on 2017/6/13 17:47
 * 邮箱：lanbuhan@163.com
 * 功能：引导页
 */
@ContentView(R.layout.base_match_linear)
public class AdvertActivity extends BaseActivity {

    @ViewInject(R.id.linear)
    LinearLayout linear;

    List<Integer> drawables;

    @Override
    public void initSucessView() {
        SharePrefUtil.saveBoolean(CommonUtil.getVersion(),true);
        drawables = Arrays.asList(ApplicationConfig.ADVERT_DRAWABLES);
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        linear.addView(new AdvertView(QXApplication.getContext(),R.layout.item_advert,drawables,
                new AdvertView.OnTransformController(){
                    @Override
                    public void onTransformController() {
                        AdvertActivity.this.finish();
                        TransformController.transformController(QXApplication.getContext(),MainActivity.class);
                    }
                }),
                new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                                            LinearLayout.LayoutParams.MATCH_PARENT));
    }


    @Override
    public void initViewHandler() {}
}
